HTMLify

index.html
Views: 66 | Author: cody
<!DOCTYPE html>
<html>

<head>
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <title>Spotlight Cursor Text Screen Animation</title>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <script src="https://code.jquery.com/jquery-3.6.1.min.js"></script>
    <link rel='stylesheet' type='text/css' media='screen' href='style.css'>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.1/gsap.min.js"
        integrity="sha512-qF6akR/fsZAB4Co1QDDnUXWnaQseLGXoniuSuSlPQK6+aWhlMZcHzkasCSlnWoe+TJuudlka1/IQ01Dnhgq95g=="
        crossorigin="anonymous" referrerpolicy="no-referrer"></script>
</head>

<body>

    <div class="cursor"></div>

    <div class="shapes">
        <div class="shape shape-1"></div>
        <div class="shape shape-2"></div>
        <div class="shape shape-3"></div>
    </div>

    <div class="content">
        <h1>Hello world!</h1>
    </div>


    <script>
        document.body.addEventListener("mousemove", evt => {
            const mouseX = evt.clientX;
            const mouseY = evt.clientY;

            gsap.set(".cursor", {
                x: mouseX,
                y: mouseY
            });

            gsap.to(".shape", {
                x: mouseX,
                y: mouseY,
                stagger: -0.1
            });
        });
    </script>
</body>

</html>

Comments